  

import utils from '@/utils'
import { useMessage } from 'naive-ui'
import { useI18n } from 'vue-i18n'

/**
 * Text copy with success message
 */
export function useTextCopy() {
  const { t } = useI18n()
  const message = useMessage()
  const copyText = (text: string) => {
    if (utils.copy(text)) {
      message.success(t('project.dag.copy_success'))
    }
  }
  return {
    copy: copyText
  }
}
